﻿namespace WSPay
{
    public abstract class PaymentRequest
    {

        /// <summary>
        /// 工具方法：创建支付表单项
        /// </summary>
        /// <param name="name">参数名</param>
        /// <param name="value">参数值</param>
        /// <returns></returns>
        protected virtual string CreateField(string name, string value)
        {
            return string.Format("<input type=\"hidden\" id=\"{0}\" name=\"{0}\" value=\"{1}\">", name, value);
        }

        /// <summary>
        /// 工具方法：创建支付表单
        /// </summary>
        /// <param name="content">表单项内容</param>
        /// <param name="action">http请求方式 get/post</param>
        /// <returns></returns>
        protected virtual string CreateForm(string content, string action)
        {
            content = content + "<input type=\"submit\" value=\"在线支付\" style=\"display:none;\">";
            return string.Format("<form id=\"payform\" name=\"payform\" action=\"{0}\" method=\"POST\">{1}</form>", new object[] { action, content });
        }
    }
}